﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NBusiness.CodeDom.Compiler;

namespace NBusiness.ESharp.Compiler
{
    public static class ESharpEntityElementTypes 
    {
        static ESharpEntityElementTypes()
        {
            #region Initialize Entity Elements
            _comment = new ESharpCommentElementType();
            _whiteSpace = new ESharpWhiteSpaceElementType();
            _familyDeclaration = new ESharpFamilyDeclarationElementType();
            _familyName = new ESharpFamilyNameElementType();
            _familyJoin = new ESharpFamilyJoinElementType();
            _usingDeclaration = new ESharpUsingDeclarationElementType();
            _usingType = new ESharpUsingTypeElementType();
            _usingTypeJoin = new ESharpUsingTypeJoinElementType();
            _entityDeclaration = new ESharpEntityDeclarationElementType();
            _entityName = new ESharpEntityNameElementType();
            _entityAs = new ESharpEntityAsElementType();
            _entityTemplateType = new ESharpEntityTemplateTypeElementType();
            _entityTemplateTypeJoin = new ESharpTemplateTypeJoinElementType();
            _entityTemplateSeparator = new ESharpEntityTemplateSeparatorElementType();
            _fieldDeclaration = new ESharpFieldDeclarationElementType();
            _fieldType = new ESharpFieldTypeElementType();
            _fieldName = new ESharpFieldNameElementType();
            _fieldIdProperty = new ESharpFieldIdPropertyElementType();
            _fieldAutoProperty = new ESharpFieldAutoPropertyElementType();
            _fieldNullableProperty = new ESharpFieldNullablePropertyElementType();
            _fieldReadOnly = new ESharpFieldReadOnlyElementType();
            _relationshipDeclaration = new ESharpRelationshipDeclarationElementType();
            _relationshipName = new ESharpRelationshipNameElementType();
            _relationshipEntity = new ESharpRelationshipEntityElementType();
            _relationshipField = new ESharpRelationshipFieldElementType();
            _relationshipWith = new ESharpRelationshipWithElementType();
            _relationshipOn = new ESharpRelationshipOnElementType();
            _relationshipAs = new ESharpRelationshipAsElementType();
            _relationshipAssign = new ESharpRelationshipAssignElementType();
            _relationshipAssignTo = new ESharpRelationshipAssignToElementType();
            _relationshipSplit = new ESharpRelationshipSplitElementType();
            _relationshipType = new ESharpRelationshipTypeElementType();
            _accessDeclaration = new ESharpAccessDeclarationElementType();
            _accessAllow = new ESharpAccessAllowElementType();
            _accessType = new ESharpAccessTypeElementType();
            _accessRole = new ESharpAccessRoleElementType();
            _accessField = new ESharpAccessFieldElementType();
            _accessMethod = new ESharpAccessMethodElementType();
            _authorizeDeclaration = new ESharpAuthorizeDeclarationElementType();
            _authorizeAllow = new ESharpAuthorizeAllowElementType();
            _authorizeType = new ESharpAuthorizeTypeElementType();
            _authorizeRole = new ESharpAuthorizeRoleElementType();
            _authorizeMethod = new ESharpAuthorizeMethodElementType();
            _validateDeclaration = new ESharpValidateDeclarationElementType();
            _validateProperty = new ESharpValidatePropertyElementType();
            _validateType = new ESharpValidateTypeElementType();
            _validateArgsBegin = new ESharpValidateArgsBeginElementType();
            _validateArgName = new ESharpValidateArgNameElementType();
            _validateArgAssign = new ESharpValidateArgAssignElementType();
            _validateArgValue = new ESharpValidateArgValueElementType();
            _validateArgSplit = new ESharpValidateArgSplitElementType();
            _validateArgsEnd = new ESharpValidateArgsEndElementType();
            _statementEnd = new ESharpStatementEndElementType();
            _actionDeclaration = new ESharpActionDeclarationElementType();
            _actionName = new ESharpActionNameElementType();
            _actionOn = new ESharpActionOnElementType();
            _actionType = new ESharpActionTypeElementType();
            _actionTypeJoin = new ESharpActionTypeJoinElementType();
            _actionWhen = new ESharpActionWhenElementType();
            _actionWhenType = new ESharpActionWhenTypeElementType();
            _actionAsync = new ESharpActionAsyncElementType();

            _inheritenceDeclaration = new ESharpInheritenceDeclarationElementType();
            _groupBegin = new ESharpGroupBeginElementType();
            _groupEnd = new ESharpGroupEndElementType();
            #endregion

            #region Initialize Model Elements
            _modelDeclaration = new ESharpModelDeclarationElementType();
            _modelReadOnly = new ESharpModelReadOnlyElementType();
            _modelName = new ESharpModelNameElementType();
            _modelBaseEntity = new ESharpModelBaseEntityElementType();
            _modelInherit = new ESharpModelInheritElementType();
            _modelInheritType = new ESharpModelInheritTypeElementType();
            _modelInheritTypeName = new ESharpModelInheritTypeNameElementType();
            _modelInheritTypeNameJoin = new ESharpModelInheritTypeNameJoinElementType();
            #endregion
        }

        #region Entity Element Fields
        private static ESharpCommentElementType _comment;
        private static ESharpWhiteSpaceElementType _whiteSpace;
        private static ESharpStatementEndElementType _statementEnd;
        private static ESharpGroupBeginElementType _groupBegin;
        private static ESharpGroupEndElementType _groupEnd;
        // family
        private static ESharpFamilyDeclarationElementType _familyDeclaration;
        private static ESharpFamilyNameElementType _familyName;
        private static ESharpFamilyJoinElementType _familyJoin;
        // using
        private static ESharpUsingDeclarationElementType _usingDeclaration;
        private static ESharpUsingTypeElementType _usingType;
        private static ESharpUsingTypeJoinElementType _usingTypeJoin;
        // entity
        private static ESharpEntityDeclarationElementType _entityDeclaration;
        private static ESharpEntityNameElementType _entityName;
        private static ESharpEntityAsElementType _entityAs;
        private static ESharpEntityTemplateTypeElementType _entityTemplateType;
        private static ESharpTemplateTypeJoinElementType _entityTemplateTypeJoin;
        private static ESharpEntityTemplateSeparatorElementType _entityTemplateSeparator;
        private static ESharpInheritenceDeclarationElementType _inheritenceDeclaration;
        // field
        private static ESharpFieldDeclarationElementType _fieldDeclaration;
        private static ESharpFieldTypeElementType _fieldType;
        private static ESharpFieldNameElementType _fieldName;
        private static ESharpFieldIdPropertyElementType _fieldIdProperty;
        private static ESharpFieldAutoPropertyElementType _fieldAutoProperty;
        private static ESharpFieldNullablePropertyElementType _fieldNullableProperty;
        private static ESharpFieldReadOnlyElementType _fieldReadOnly;
        // relationship
        private static ESharpRelationshipDeclarationElementType _relationshipDeclaration;
        private static ESharpRelationshipNameElementType _relationshipName;
        private static ESharpRelationshipEntityElementType _relationshipEntity;
        private static ESharpRelationshipFieldElementType _relationshipField;
        private static ESharpRelationshipWithElementType _relationshipWith;
        private static ESharpRelationshipOnElementType _relationshipOn;
        private static ESharpRelationshipAsElementType _relationshipAs;
        private static ESharpRelationshipAssignElementType _relationshipAssign;
        private static ESharpRelationshipAssignToElementType _relationshipAssignTo;
        private static ESharpRelationshipSplitElementType _relationshipSplit;
        private static ESharpRelationshipTypeElementType _relationshipType;
        // access
        private static ESharpAccessDeclarationElementType _accessDeclaration;
        private static ESharpAccessAllowElementType _accessAllow;
        private static ESharpAccessRoleElementType _accessRole;
        private static ESharpAccessTypeElementType _accessType;
        private static ESharpAccessFieldElementType _accessField;
        private static ESharpAccessMethodElementType _accessMethod;
        // authorize
        private static ESharpAuthorizeDeclarationElementType _authorizeDeclaration;
        private static ESharpAuthorizeAllowElementType _authorizeAllow;
        private static ESharpAuthorizeTypeElementType _authorizeType;
        private static ESharpAuthorizeRoleElementType _authorizeRole;
        private static ESharpAuthorizeMethodElementType _authorizeMethod;
        // validation
        private static ESharpValidateDeclarationElementType _validateDeclaration;
        private static ESharpValidatePropertyElementType _validateProperty;
        private static ESharpValidateTypeElementType _validateType;
        private static ESharpValidateArgsBeginElementType _validateArgsBegin;
        private static ESharpValidateArgNameElementType _validateArgName;
        private static ESharpValidateArgAssignElementType _validateArgAssign;
        private static ESharpValidateArgValueElementType _validateArgValue;
        private static ESharpValidateArgSplitElementType _validateArgSplit;
        private static ESharpValidateArgsEndElementType _validateArgsEnd;
        // action
        private static ESharpActionDeclarationElementType _actionDeclaration;
        private static ESharpActionNameElementType _actionName;
        private static ESharpActionOnElementType _actionOn;
        private static ESharpActionTypeElementType _actionType;
        private static ESharpActionTypeJoinElementType _actionTypeJoin;
        private static ESharpActionWhenElementType _actionWhen;
        private static ESharpActionWhenTypeElementType _actionWhenType;
        private static ESharpActionAsyncElementType _actionAsync;
        #endregion

        #region Model element fields
        private static ESharpModelDeclarationElementType _modelDeclaration;
        private static ESharpModelReadOnlyElementType _modelReadOnly;
        private static ESharpModelNameElementType _modelName;
        private static ESharpModelBaseEntityElementType _modelBaseEntity;
        private static ESharpModelInheritElementType _modelInherit;
        private static ESharpModelInheritTypeElementType _modelInheritType;
        private static ESharpModelInheritTypeNameElementType _modelInheritTypeName;
        private static ESharpModelInheritTypeNameJoinElementType _modelInheritTypeNameJoin;
        #endregion

        #region Entity Element Properties
        // common
        public static ESharpStatementEndElementType StatementEnd { get { return _statementEnd; } }
        public static ESharpCommentElementType Comment { get { return _comment; } }
        public static ESharpGroupBeginElementType GroupBegin { get { return _groupBegin; } }
        public static ESharpGroupEndElementType GroupEnd { get { return _groupEnd; } }
        public static ESharpWhiteSpaceElementType WhiteSpace { get { return _whiteSpace; } }
        // family
        public static ESharpFamilyDeclarationElementType FamilyDeclaration { get { return _familyDeclaration; } }
        public static ESharpFamilyNameElementType FamilyName { get { return _familyName; } }
        public static ESharpFamilyJoinElementType FamilyJoin { get { return _familyJoin; } }
        // using
        public static ESharpUsingDeclarationElementType UsingDeclaration { get { return _usingDeclaration; } }
        public static ESharpUsingTypeElementType UsingType { get { return _usingType; } }
        public static ESharpUsingTypeJoinElementType UsingTypeJoin { get { return _usingTypeJoin; } }
        // entity
        public static ESharpEntityDeclarationElementType EntityDeclaration { get { return _entityDeclaration; } }
        public static ESharpEntityNameElementType EntityName { get { return _entityName; } }
        public static ESharpEntityAsElementType EntityAs { get { return _entityAs; } }
        public static ESharpEntityTemplateTypeElementType EntityTemplateType { get { return _entityTemplateType; } }
        public static ESharpTemplateTypeJoinElementType EntityTemplateTypeJoin { get { return _entityTemplateTypeJoin; } }
        public static ESharpEntityTemplateSeparatorElementType EntityTemplateSeparator { get { return _entityTemplateSeparator; } }
        public static ESharpInheritenceDeclarationElementType InheritenceDeclaration { get { return _inheritenceDeclaration; } }
        // fields
        public static ESharpFieldDeclarationElementType FieldDeclaration { get { return _fieldDeclaration; } }
        public static ESharpFieldTypeElementType FieldType { get { return _fieldType; } }
        public static ESharpFieldNameElementType FieldName { get { return _fieldName; } }
        public static ESharpFieldIdPropertyElementType FieldIdProperty { get { return _fieldIdProperty; } }
        public static ESharpFieldAutoPropertyElementType FieldAutoProperty { get { return _fieldAutoProperty; } }
        public static ESharpFieldNullablePropertyElementType FieldNullableProperty { get { return _fieldNullableProperty; } }
        public static ESharpFieldReadOnlyElementType FieldReadOnly { get { return _fieldReadOnly; } }
        // relationships
        public static ESharpRelationshipDeclarationElementType RelationshipDeclaration { get { return _relationshipDeclaration; } }
        public static ESharpRelationshipNameElementType RelationshipName { get { return _relationshipName; } }
        public static ESharpRelationshipEntityElementType RelationshipEntity { get { return _relationshipEntity; } }
        public static ESharpRelationshipFieldElementType RelationshipField { get { return _relationshipField; } }
        public static ESharpRelationshipWithElementType RelationshipWith { get { return _relationshipWith; } }
        public static ESharpRelationshipOnElementType RelationshipOn { get { return _relationshipOn; } }
        public static ESharpRelationshipAsElementType RelationshipAs { get { return _relationshipAs; } }
        public static ESharpRelationshipAssignElementType RelationshipAssign { get { return _relationshipAssign; } }
        public static ESharpRelationshipAssignToElementType RelationshipAssignTo { get { return _relationshipAssignTo; } }
        public static ESharpRelationshipSplitElementType RelationshipSplit { get { return _relationshipSplit; } }
        public static ESharpRelationshipTypeElementType RelationshipType { get { return _relationshipType; } }
        // access
        public static ESharpAccessDeclarationElementType AccessDeclaration { get { return _accessDeclaration; } }
        public static ESharpAccessAllowElementType AccessAllow { get { return _accessAllow; } }
        public static ESharpAccessRoleElementType AccessRole { get { return _accessRole; } }
        public static ESharpAccessFieldElementType AccessField { get { return _accessField; } }
        public static ESharpAccessTypeElementType AccessType { get { return _accessType; } }
        public static ESharpAccessMethodElementType AccessMethod { get { return _accessMethod; } }
        // authorization
        public static ESharpAuthorizeDeclarationElementType AuthorizeDeclaration { get { return _authorizeDeclaration; } }
        public static ESharpAuthorizeAllowElementType AuthorizeAllow { get { return _authorizeAllow; } }
        public static ESharpAuthorizeTypeElementType AuthorizeType { get { return _authorizeType; } }
        public static ESharpAuthorizeRoleElementType AuthorizeRole { get { return _authorizeRole; } }
        public static ESharpAuthorizeMethodElementType AuthorizeMethod { get { return _authorizeMethod; } }
        // validation
        public static ESharpValidateDeclarationElementType ValidateDeclaration { get { return _validateDeclaration; } }
        public static ESharpValidatePropertyElementType ValidateProperty { get { return _validateProperty; } }
        public static ESharpValidateTypeElementType ValidateType { get { return _validateType; } }
        public static ESharpValidateArgsBeginElementType ValidateArgsBegin { get { return _validateArgsBegin; } }
        public static ESharpValidateArgNameElementType ValidateArgName { get { return _validateArgName; } }
        public static ESharpValidateArgValueElementType ValidateArgValue { get { return _validateArgValue; } }
        public static ESharpValidateArgAssignElementType ValidateArgAssign { get { return _validateArgAssign; } }
        public static ESharpValidateArgSplitElementType ValidateArgSplit { get { return _validateArgSplit; } }
        public static ESharpValidateArgsEndElementType ValidateArgsEnd { get { return _validateArgsEnd; } }
        // actions
        public static ESharpActionDeclarationElementType ActionDeclaration { get { return _actionDeclaration; } }
        public static ESharpActionNameElementType ActionName { get { return _actionName; } }
        public static ESharpActionOnElementType ActionOn { get { return _actionOn; } }
        public static ESharpActionTypeElementType ActionType { get { return _actionType; } }
        public static ESharpActionTypeJoinElementType ActionTypeJoin { get { return _actionTypeJoin; } }
        public static ESharpActionWhenElementType ActionWhen { get { return _actionWhen; } }
        public static ESharpActionWhenTypeElementType ActionWhenType { get { return _actionWhenType; } }
        public static ESharpActionAsyncElementType ActionAsync { get { return _actionAsync; } }
       
        #endregion

        #region Model properties
        public static ESharpModelDeclarationElementType ModelDeclaration { get { return _modelDeclaration; } }
        public static ESharpModelReadOnlyElementType ModelReadOnly { get { return _modelReadOnly; } }
        public static ESharpModelNameElementType ModelName { get { return _modelName; } }
        public static ESharpModelBaseEntityElementType ModelBaseEntity { get { return _modelBaseEntity; } }
        public static ESharpModelInheritElementType ModelInherit { get { return _modelInherit; } }
        public static ESharpModelInheritTypeElementType ModelInheritType { get { return _modelInheritType; } }
        public static ESharpModelInheritTypeNameElementType ModelInheritTypeName { get { return _modelInheritTypeName; } }
        public static ESharpModelInheritTypeNameJoinElementType ModelInheritTypeNameJoin { get { return _modelInheritTypeNameJoin; } }
        #endregion
    }

    #region Entity Element Declarations
    [Serializable]
    public class ESharpCommentElementType : EntityElementType
    {
        public ESharpCommentElementType()
            : base(ESharpParser.Expressions.LineComments, false, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { EntityElementType.Any }; }
        }
    }
    
    [Serializable]
    public class ESharpWhiteSpaceElementType : EntityElementType
    {
        public ESharpWhiteSpaceElementType()
            : base(ESharpParser.Expressions.WhiteSpace, false)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { EntityElementType.Any }; }
        }
    }

    [Serializable]
    public class ESharpFamilyDeclarationElementType : EntityElementType
    {
        public ESharpFamilyDeclarationElementType()
            : base(ESharpParser.Expressions.FamilyDeclaration, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                EntityElementType.Unknown,
            ESharpEntityElementTypes.StatementEnd };
            }
        }
    }

    [Serializable]
    public class ESharpFamilyNameElementType : EntityElementType
    {
        public ESharpFamilyNameElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get 
            { 
                return new EntityElementType[] { 
                    ESharpEntityElementTypes.FamilyDeclaration,
                    ESharpEntityElementTypes.FamilyJoin }; 
            }
        }
    }

    [Serializable]
    public class ESharpFamilyJoinElementType : EntityElementType
    {
        public ESharpFamilyJoinElementType()
            : base(ESharpParser.Expressions.FamilyJoin, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.FamilyName }; }
        }
    }

    [Serializable]
    public class ESharpUsingDeclarationElementType : EntityElementType
    {
        public ESharpUsingDeclarationElementType()
            : base(ESharpParser.Expressions.UsingDeclaration, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get 
            { 
                return new EntityElementType[] { 
                EntityElementType.Unknown,
                ESharpEntityElementTypes.StatementEnd }; 
            }
        }
    }

    [Serializable]
    public class ESharpUsingTypeElementType : EntityElementType
    {
        public ESharpUsingTypeElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                ESharpEntityElementTypes.UsingDeclaration,
                ESharpEntityElementTypes.UsingTypeJoin };
            }
        }
    }

    [Serializable]
    public class ESharpUsingTypeJoinElementType : EntityElementType
    {
        public ESharpUsingTypeJoinElementType()
            : base(ESharpParser.Expressions.UsingJoin, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.UsingType }; }
        }
    }

    [Serializable]
    public class ESharpEntityDeclarationElementType : EntityElementType
    {
        public ESharpEntityDeclarationElementType()
            : base(ESharpParser.Expressions.EntityDeclaration, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { EntityElementType.Any }; }
        }
    }

    [Serializable]
    public class ESharpEntityNameElementType : EntityElementType
    {
        public ESharpEntityNameElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.EntityDeclaration }; }
        }
    }

    [Serializable]
    public class ESharpEntityAsElementType : EntityElementType
    {
        public ESharpEntityAsElementType()
            : base(ESharpParser.Expressions.EntityAs, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { 
                ESharpEntityElementTypes.EntityName,
                ESharpEntityElementTypes.ModelBaseEntity }; }
        }
    }

    [Serializable]
    public class ESharpEntityTemplateTypeElementType : EntityElementType
    {
        public ESharpEntityTemplateTypeElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                ESharpEntityElementTypes.EntityAs,
                ESharpEntityElementTypes.EntityTemplateSeparator,
                ESharpEntityElementTypes.EntityTemplateTypeJoin };
            }
        }
    }

    [Serializable]
    public class ESharpTemplateTypeJoinElementType : EntityElementType
    {
        public ESharpTemplateTypeJoinElementType()
            : base(ESharpParser.Expressions.EntityTemplateJoin, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.EntityTemplateType }; }
        }
    }

    [Serializable]
    public class ESharpEntityTemplateSeparatorElementType : EntityElementType
    {
        public ESharpEntityTemplateSeparatorElementType()
            : base(ESharpParser.Expressions.EntityTemplateSeparator, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.EntityTemplateType }; }
        }
    }

    [Serializable]
    public class ESharpFieldDeclarationElementType : EntityElementType
    {
        public ESharpFieldDeclarationElementType()
            : base(ESharpParser.Expressions.FieldDeclaration, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                ESharpEntityElementTypes.GroupBegin,
                ESharpEntityElementTypes.StatementEnd,
                EntityElementType.Unknown };
            }
        }
    }

    [Serializable]
    public class ESharpFieldTypeElementType : EntityElementType
    {
        public ESharpFieldTypeElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                ESharpEntityElementTypes.FieldDeclaration,
                ESharpEntityElementTypes.FieldNullableProperty,
                ESharpEntityElementTypes.FieldReadOnly,
                ESharpEntityElementTypes.FieldIdProperty };
            }
        }
    }

    [Serializable]
    public class ESharpFieldNameElementType : EntityElementType
    {
        public ESharpFieldNameElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.FieldType }; }
        }
    }

    [Serializable]
    public class ESharpFieldIdPropertyElementType : EntityElementType
    {
        public ESharpFieldIdPropertyElementType()
            : base(ESharpParser.Expressions.FieldIdProperty, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                ESharpEntityElementTypes.FieldDeclaration,
                ESharpEntityElementTypes.FieldAutoProperty };
            }
        }
    }

    [Serializable]
    public class ESharpFieldAutoPropertyElementType : EntityElementType
    {
        public ESharpFieldAutoPropertyElementType()
            : base(ESharpParser.Expressions.FieldAutoProperty, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.FieldDeclaration }; }
        }
    }

    [Serializable]
    public class ESharpFieldNullablePropertyElementType : EntityElementType
    {
        public ESharpFieldNullablePropertyElementType()
            : base(ESharpParser.Expressions.FieldNullableProperty, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.FieldDeclaration }; }
        }
    }

    [Serializable]
    public class ESharpFieldReadOnlyElementType : EntityElementType
    {
        public ESharpFieldReadOnlyElementType()
            : base(ESharpParser.Expressions.FieldReadOnly, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                ESharpEntityElementTypes.FieldDeclaration,
            ESharpEntityElementTypes.FieldNullableProperty };
            }
        }
    }

    [Serializable]
    public class ESharpRelationshipDeclarationElementType : EntityElementType
    {
        public ESharpRelationshipDeclarationElementType()
            : base(ESharpParser.Expressions.RelationshipDeclaration, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                ESharpEntityElementTypes.GroupBegin,
                ESharpEntityElementTypes.StatementEnd,
                EntityElementType.Unknown };
            }
        }
    }

    [Serializable]
    public class ESharpRelationshipNameElementType : EntityElementType
    {
        public ESharpRelationshipNameElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.RelationshipDeclaration }; }
        }
    }

    [Serializable]
    public class ESharpRelationshipWithElementType : EntityElementType
    {
        public ESharpRelationshipWithElementType()
            : base(ESharpParser.Expressions.RelationshipWith, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.RelationshipName }; }
        }
    }

    [Serializable]
    public class ESharpRelationshipEntityElementType : EntityElementType
    {
        public ESharpRelationshipEntityElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.RelationshipWith }; }
        }
    }

    [Serializable]
    public class ESharpRelationshipOnElementType : EntityElementType
    {
        public ESharpRelationshipOnElementType()
            : base(ESharpParser.Expressions.RelationshipOn, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.RelationshipEntity }; }
        }
    }

    [Serializable]
    public class ESharpRelationshipFieldElementType : EntityElementType
    {
        public ESharpRelationshipFieldElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                ESharpEntityElementTypes.RelationshipOn,
                ESharpEntityElementTypes.RelationshipSplit };
            }
        }
    }

    [Serializable]
    public class ESharpRelationshipAssignElementType : EntityElementType
    {
        public ESharpRelationshipAssignElementType()
            : base(ESharpParser.Expressions.RelationshipAssign, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.RelationshipField }; }
        }
    }

    [Serializable]
    public class ESharpRelationshipAssignToElementType : EntityElementType
    {
        public ESharpRelationshipAssignToElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.RelationshipAssign }; }
        }
    }

    [Serializable]
    public class ESharpRelationshipSplitElementType : EntityElementType
    {
        public ESharpRelationshipSplitElementType()
            : base(ESharpParser.Expressions.RelationshipSplit, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.RelationshipAssignTo }; }
        }
    }

    [Serializable]
    public class ESharpRelationshipAsElementType : EntityElementType
    {
        public ESharpRelationshipAsElementType()
            : base(ESharpParser.Expressions.RelationshipAs, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                ESharpEntityElementTypes.RelationshipAssignTo,
                ESharpEntityElementTypes.RelationshipEntity };
            }
        }
    }

    [Serializable]
    public class ESharpRelationshipTypeElementType : EntityElementType
    {
        public ESharpRelationshipTypeElementType()
            : base(ESharpParser.Expressions.RelationshipType, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.RelationshipAs }; }
        }
    }

    [Serializable]
    public class ESharpAccessDeclarationElementType : EntityElementType
    {
        public ESharpAccessDeclarationElementType()
            : base(ESharpParser.Expressions.AccessDeclaration, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                ESharpEntityElementTypes.GroupBegin,
                ESharpEntityElementTypes.StatementEnd,
                EntityElementType.Unknown };
            }
        }
    }

    [Serializable]
    public class ESharpAccessAllowElementType : EntityElementType
    {
        public ESharpAccessAllowElementType()
            : base(ESharpParser.Expressions.DenyAllow, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.AccessDeclaration }; }
        }
    }

    [Serializable]
    public class ESharpAccessTypeElementType : EntityElementType
    {
        public ESharpAccessTypeElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.AccessAllow }; }
        }
    }

    [Serializable]
    public class ESharpAccessRoleElementType : EntityElementType
    {
        public ESharpAccessRoleElementType()
            : base(ESharpParser.Expressions.RoleName, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.AccessType }; }
        }
    }

    [Serializable]
    public class ESharpAccessMethodElementType : EntityElementType
    {
        public ESharpAccessMethodElementType()
            : base(ESharpParser.Expressions.AccessMethod, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.AccessRole }; }
        }
    }

    [Serializable]
    public class ESharpAccessFieldElementType : EntityElementType
    {
        public ESharpAccessFieldElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.AccessMethod }; }
        }
    }

    [Serializable]
    public class ESharpAuthorizeDeclarationElementType : EntityElementType
    {
        public ESharpAuthorizeDeclarationElementType()
            : base(ESharpParser.Expressions.AuthorizeDeclaration, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                ESharpEntityElementTypes.GroupBegin,
                ESharpEntityElementTypes.StatementEnd,
                EntityElementType.Unknown };
            }
        }
    }

    [Serializable]
    public class ESharpAuthorizeAllowElementType : EntityElementType
    {
        public ESharpAuthorizeAllowElementType()
            : base(ESharpParser.Expressions.DenyAllow, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.AuthorizeDeclaration }; }
        }
    }

    [Serializable]
    public class ESharpAuthorizeTypeElementType : EntityElementType
    {
        public ESharpAuthorizeTypeElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.AuthorizeAllow }; }
        }
    }

    [Serializable]
    public class ESharpAuthorizeRoleElementType : EntityElementType
    {
        public ESharpAuthorizeRoleElementType()
            : base(ESharpParser.Expressions.RoleName, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.AuthorizeType }; }
        }
    }

    [Serializable]
    public class ESharpAuthorizeMethodElementType : EntityElementType
    {
        public ESharpAuthorizeMethodElementType()
            : base(ESharpParser.Expressions.AuthorizeMethod, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.AuthorizeRole }; }
        }
    }

    [Serializable]
    public class ESharpValidateDeclarationElementType : EntityElementType
    {
        public ESharpValidateDeclarationElementType()
            : base(ESharpParser.Expressions.ValidateDeclaration, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                ESharpEntityElementTypes.GroupBegin,
                ESharpEntityElementTypes.StatementEnd,
                EntityElementType.Unknown };
            }
        }
    }

    [Serializable]
    public class ESharpValidatePropertyElementType : EntityElementType
    {
        public ESharpValidatePropertyElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.ValidateDeclaration }; }
        }
    }

    [Serializable]
    public class ESharpValidateTypeElementType : EntityElementType
    {
        public ESharpValidateTypeElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.ValidateProperty }; }
        }
    }

    [Serializable]
    public class ESharpValidateArgsBeginElementType : EntityElementType
    {
        public ESharpValidateArgsBeginElementType()
            : base(ESharpParser.Expressions.ValidateArgsBegin, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                    ESharpEntityElementTypes.ValidateType};
            }
        }
    }

    [Serializable]
    public class ESharpValidateArgNameElementType : EntityElementType
    {
        public ESharpValidateArgNameElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                    ESharpEntityElementTypes.ValidateArgsBegin,
                    ESharpEntityElementTypes.ValidateArgSplit };
            }
        }
    }

    [Serializable]
    public class ESharpValidateArgAssignElementType : EntityElementType
    {
        public ESharpValidateArgAssignElementType()
            : base(ESharpParser.Expressions.ValidateArgAssign, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { 
                ESharpEntityElementTypes.ValidateArgName }; }
        }
    }

    [Serializable]
    public class ESharpValidateArgValueElementType : EntityElementType
    {
        public ESharpValidateArgValueElementType()
            : base(ESharpParser.Expressions.ValidateArg, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                    ESharpEntityElementTypes.ValidateArgAssign,
                    ESharpEntityElementTypes.ValidateArgSplit,
                    ESharpEntityElementTypes.ValidateArgsBegin };
            }
        }
    }
    
    [Serializable]
    public class ESharpValidateArgsEndElementType : EntityElementType
    {
        public ESharpValidateArgsEndElementType()
            : base(ESharpParser.Expressions.ValidateArgsEnd, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] { 
                    ESharpEntityElementTypes.ValidateArgsBegin,
                    ESharpEntityElementTypes.ValidateArgValue };
            }
        }
    }
    
    [Serializable]
    public class ESharpValidateArgSplitElementType : EntityElementType
    {
        public ESharpValidateArgSplitElementType()
            : base(ESharpParser.Expressions.ValidateArgSplit, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.ValidateArgValue }; }
        }
    }

    [Serializable]
    public class ESharpActionDeclarationElementType : EntityElementType
    {
        public ESharpActionDeclarationElementType()
            : base(ESharpParser.Expressions.ActionDeclaration, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                ESharpEntityElementTypes.GroupBegin,
                ESharpEntityElementTypes.StatementEnd,
                EntityElementType.Unknown };
            }
        }
    }

    [Serializable]
    public class ESharpActionNameElementType : EntityElementType
    {
        public ESharpActionNameElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.ActionDeclaration }; }
        }
    }

    [Serializable]
    public class ESharpActionOnElementType : EntityElementType
    {
        public ESharpActionOnElementType()
            : base(ESharpParser.Expressions.ActionOn, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.ActionName }; }
        }
    }

    [Serializable]
    public class ESharpActionTypeElementType : EntityElementType
    {
        public ESharpActionTypeElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                ESharpEntityElementTypes.ActionOn,
            ESharpEntityElementTypes.ActionTypeJoin };
            }
        }
    }

    [Serializable]
    public class ESharpActionTypeJoinElementType : EntityElementType
    {
        public ESharpActionTypeJoinElementType()
            : base(ESharpParser.Expressions.ActionTypeJoin, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.ActionType }; }
        }
    }

    [Serializable]
    public class ESharpActionWhenElementType : EntityElementType
    {
        public ESharpActionWhenElementType()
            : base(ESharpParser.Expressions.ActionWhen, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                ESharpEntityElementTypes.ActionType,
            ESharpEntityElementTypes.ActionName };
            }
        }
    }

    [Serializable]
    public class ESharpActionWhenTypeElementType : EntityElementType
    {
        public ESharpActionWhenTypeElementType()
            : base(ESharpParser.Expressions.ActionWhenType, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.ActionWhen }; }
        }
    }

    [Serializable]
    public class ESharpActionAsyncElementType : EntityElementType
    {
        public ESharpActionAsyncElementType()
            : base(ESharpParser.Expressions.ActionAsync, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { ESharpEntityElementTypes.ActionWhenType }; }
        }
    }

    [Serializable]
    public class ESharpStatementEndElementType : EntityElementType
    {
        public ESharpStatementEndElementType()
            : base(ESharpParser.Expressions.StatementEnd, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                EntityElementType.Unknown,
                ESharpEntityElementTypes.FieldName,
                ESharpEntityElementTypes.RelationshipType,
                ESharpEntityElementTypes.AccessField,
                ESharpEntityElementTypes.AuthorizeMethod,
                ESharpEntityElementTypes.ActionAsync,
                ESharpEntityElementTypes.ActionName,
                ESharpEntityElementTypes.ActionType,
                ESharpEntityElementTypes.ActionWhenType,
                ESharpEntityElementTypes.ValidateArgName,
                ESharpEntityElementTypes.ValidateType,
                ESharpEntityElementTypes.ValidateArgsEnd,
                ESharpEntityElementTypes.ModelInheritTypeName,
                ESharpEntityElementTypes.UsingType };
            }
        }
    }

    [Serializable]
    public class ESharpGroupBeginElementType : EntityElementType
    {
        public ESharpGroupBeginElementType()
            : base(ESharpParser.Expressions.GroupBegin, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                ESharpEntityElementTypes.EntityName,
                ESharpEntityElementTypes.EntityTemplateType,
                ESharpEntityElementTypes.FamilyName };
            }
        }
    }

    [Serializable]
    public class ESharpGroupEndElementType : EntityElementType
    {
        public ESharpGroupEndElementType()
            : base(ESharpParser.Expressions.GroupEnd, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] {
                ESharpEntityElementTypes.GroupEnd,
                ESharpEntityElementTypes.StatementEnd,
                EntityElementType.Unknown };
            }
        }
    }

    #endregion

    #region Model element declarations
    // ModelDeclaration
    [Serializable]
    public class ESharpModelDeclarationElementType : EntityElementType
    {
        public ESharpModelDeclarationElementType()
            : base(ESharpParser.Expressions.ModelDeclaration, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get { return new EntityElementType[] { 
                ESharpEntityElementTypes.GroupBegin,
                ESharpEntityElementTypes.GroupEnd }; }
        }
    }
    // ModelReadOnly
    [Serializable]
    public class ESharpModelReadOnlyElementType : EntityElementType
    {
        public ESharpModelReadOnlyElementType()
            : base(ESharpParser.Expressions.ModelReadOnly, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] { 
                ESharpEntityElementTypes.ModelDeclaration };
            }
        }
    }

    // ModelName
    [Serializable]
    public class ESharpModelNameElementType : EntityElementType
    {
        public ESharpModelNameElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] { 
                    ESharpEntityElementTypes.ModelDeclaration,
                    ESharpEntityElementTypes.ModelReadOnly };
            }
        }
    }
    // Inheritence Declaration
    [Serializable]
    public class ESharpInheritenceDeclarationElementType : EntityElementType
    {
        public ESharpInheritenceDeclarationElementType()
            : base(ESharpParser.Expressions.Inherits, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] { ESharpEntityElementTypes.ModelName };
            }
        }
    }
    // ModelBaseEntity
    [Serializable]
    public class ESharpModelBaseEntityElementType : EntityElementType
    {
        public ESharpModelBaseEntityElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] { ESharpEntityElementTypes.InheritenceDeclaration };
            }
        }
    }

    // EntityAs
    // EntityTemplate
    // EntityTemplateSplit

    // ModelInherit
    [Serializable]
    public class ESharpModelInheritElementType : EntityElementType
    {
        public ESharpModelInheritElementType()
            : base(ESharpParser.Expressions.ModelInherit, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] { 
                    ESharpEntityElementTypes.StatementEnd,
                    ESharpEntityElementTypes.GroupBegin,
                    EntityElementType.Unknown };
            }
        }
    }
    // ModelInheritType
    [Serializable]
    public class ESharpModelInheritTypeElementType : EntityElementType
    {
        public ESharpModelInheritTypeElementType()
            : base(ESharpParser.Expressions.ModelInheritType, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] { 
                    ESharpEntityElementTypes.ModelInherit };
            }
        }
    }
    // ModelInheritTypeName
    [Serializable]
    public class ESharpModelInheritTypeNameElementType : EntityElementType
    {
        public ESharpModelInheritTypeNameElementType()
            : base(ESharpParser.Expressions.Identifier, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] { 
                    ESharpEntityElementTypes.ModelInheritType,
                    ESharpEntityElementTypes.ModelInheritTypeNameJoin };
            }
        }
    }
    // ModelInheritTypeNameJoin
    [Serializable]
    public class ESharpModelInheritTypeNameJoinElementType : EntityElementType
    {
        public ESharpModelInheritTypeNameJoinElementType()
            : base(ESharpParser.Expressions.ModelInheritTypeNameJoin, true)
        { }

        public override EntityElementType[] PreviousTypes
        {
            get
            {
                return new EntityElementType[] { 
                    ESharpEntityElementTypes.ModelInheritTypeName };
            }
        }
    }

    // validation rules
    // access rules
    // authorization rules
    // actions
    #endregion
}
